package com.example.lanouhn.firstapp.activity.thread;

import android.os.Handler;
import android.os.Message;


/**
 * Created by lanouhn on 16/6/23.
 */
public class OneThread extends Thread {

    private Handler handler;

    public OneThread(Handler handler) {
        this.handler = handler;
    }

    @Override
    public void run() {
        super.run();

        for (int i = 5; i >=-1 ; i--) {


                try {
                    Thread.sleep(100);


                    Message msg = handler.obtainMessage();
                    msg.what = 0x101;   //十六进制0x----
                    msg.obj = i;

                    handler.sendMessage(msg);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }


            }

        }


    }




